home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6977 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.mindlink.net!news
  2. From: genew@mindlink.bc.ca (Gene Wirchenko)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Logical exclusive-or
  5. Date: Fri, 16 Feb 1996 21:29:12 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4g2t3o$jp8@fountain.mindlink.net>
  8. References: <4f6lrq$bcr@lastactionhero.rs.itd.umich.edu> <4f7688$4te@beach.and.nl> <1996Feb14.115653.16697@friend.kastle.com>
  9. NNTP-Posting-Host: line137.nwm.mindlink.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. rich@kastle.com (Richard Krehbiel) wrote:
  13.  
  14. >jos@and.nl (Jos A. Horsmeier) wrote:
  15.  
  16. >>In article <4f6lrq$bcr@lastactionhero.rs.itd.umich.edu>, davidm@umich.edu 
  17. >>wrote:
  18.  
  19. >>|Is there a good reason why C doesn't have a logical exclusive-or
  20. >>|operator?  A look at the precedence hierarchy suggests an obvious
  21. >>|symbol and precedence for such an operator:
  22.  
  23. >>Note that although the logical 'and' and 'or' operators do not 
  24. >>evaluate their right operand if their left operand is false or
  25. >>true resepectively, the 'logical exclusive or' operator must
  26. >>evaluate both operands no matter what the value of the left hand
  27. >>operand is. So the sole purpose of a '^^' operator would be a lexical
  28. >>shorthand for: 
  29.  
  30. >>    a ^^ b == (!(a) != !(b)) 
  31.  
  32. >>That wouldn't be much of added functionality, would it?
  33.  
  34. >Well, it wouldn't be the first time that C offered more than one way
  35. >to do something...
  36.  
  37. [examples snipped]
  38.  
  39. >In all my C programming I have never encountered a place where I'd
  40. >have liked a logical exclusive-or.  I don't think there's a need.
  41.  
  42.      Well, I have encountered such a place in my HLL programming: once
  43. or maybe twice.  I don't think there's a need.
  44.  
  45. >--
  46. >Richard Krehbiel, Kastle Systems, Arlington VA USA
  47. >rich@kastle.com (work) or richk@mnsinc.com (personal)
  48.  
  49. Sincerely,
  50.  
  51. Gene Wirchenko
  52.  
  53. C Pronunciation Guide:
  54.      y=x++;     "wye equals ex plus plus semicolon"
  55.      x=x++;     "ex equals ex doublecross semicolon"
  56.  
  57.